﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace FlexiCommerce.Configuration
{
    public class PatternValueElement : ConfigurationElement
    {
        public PatternValueElement()
        {
        }

        public PatternValueElement(string pattern, string value, bool serverValidate)
        {
            Pattern = pattern;
            Value = value;
            ServerValidate = serverValidate;
        }

        /// <summary>A regular expression pattern used match replacements. This pattern should work both server and client side.</summary>
        [ConfigurationProperty("pattern")]
        public string Pattern
        {
            get { return (string)base["pattern"]; }
            set { base["pattern"] = value; }
        }

        /// <summary>The string to replace the pattern with.</summary>
        [ConfigurationProperty("value")]
        public string Value
        {
            get { return (string)base["value"]; }
            set { base["value"] = value; }
        }

        /// <summary>Validate on the server side that the pattern is not present in the name.</summary>
        [ConfigurationProperty("serverValidate", DefaultValue = true)]
        public bool ServerValidate
        {
            get { return (bool)base["serverValidate"]; }
            set { base["serverValidate"] = value; }
        }
    }
}
